/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sun.scheduler.io;

import java.util.ArrayList;
import java.util.Date;
import sun.scheduler.core.Main;
import sun.scheduler.core.ScheduleGraph;
import sun.scheduler.core.job.JobInfo;
import sun.scheduler.core.resource.Resource;
import sun.scheduler.util.graph.Edge;
import sun.scheduler.util.graph.Graph;
import sun.scheduler.util.graph.algorithm.maxflow.EdgeFlowImpl;
import sun.scheduler.util.graph.algorithm.maxflow.ResidualGraph;

/**
 *
 * @author taiga
 */
public class IckTesteAllet {
    public static void main (String args[]) {
                ArrayList<Resource> aRes = ScheduleReader.readFileResources();
                ArrayList<JobInfo> aJob = ScheduleReader.readFileJobs(aRes);
        
                Date startDate = ScheduleReader.getStartDate();
                
                ScheduleGraph sG = new ScheduleGraph(aJob);
                Main.computeCostCurve(aJob);
                sG.updateEarliestStartTimes();
                sG.updateJobTimeParameters();
                sG.updateLatestEndTimes();
                sG.updateNodeStartTimes();
                ScheduleWriter.writeToFile(aJob, startDate, sG.getCState());
                ScheduleWriter.writeResToFile(aRes);
                System.out.println("Initcurve \n" + Main.getInitialCurve());
//        Graph graph = new Graph(4);
//        graph.addNode(null);
//        graph.addNode(null);
//        graph.addNode(null);
//        graph.addNode(null);
//        Edge e1 = graph.addEdge(0, 1, null);
//        Edge e2 = graph.addEdge(1, 2, null);
//        Edge e3 = graph.addEdge(2, 3, null);
//        
//        ResidualGraph rGraph = new ResidualGraph(graph);
//        rGraph.addEdge(e1, new EdgeFlowImpl(2));
//        rGraph.addEdge(e2, new EdgeFlowImpl(3));
//        rGraph.addEdge(e3, new EdgeFlowImpl(4));
//
//        rGraph.augmentPath(0, 3);
//        System.out.println(rGraph);
    }
}
